<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<body>
<form class="layui-form layui-form-pane" id="operatePage" style="padding-bottom: 200px">
    <div class="page-title">
        <div class="page-title-con">
            <span>收条</span>
            <div class="move_title"></div>
            <?php include "../public/sub.php";?>
        </div>
    </div>

    <div class="main-container">
        <div class="layui-form-item">
            <div class="layui-row layui-col-space10">
                <div class="edittits"><span>放款到账信息</span></div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row layui-col-space10">
                <div class="layui-col-md12">
                    <label class="layui-form-label"><text>*</text>放款到账金额</label>
                    <div class="layui-input-block">
                        <input type="text" id="daomoney" name="daomoney" placeholder="请输入" clearable autocomplete="off" class="layui-input moneyinput">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row layui-col-space10">
                <div class="layui-col-md12">
                    <label class="layui-form-label">到账日期</label>
                    <div class="layui-input-block">
                        <input type="text" name="daodt" id="daodt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item height_auto">
            <div class="layui-row layui-col-space10">
                <div class="layui-col-md12">
                    <label class="layui-form-label label_textarea">放款说明</label>
                    <div class="layui-input-block">
                        <textarea id="daoshuo" name="daoshuo" placeholder="请输入" class="layui-textarea"></textarea>
                    </div>
                </div>
            </div>
        </div>

        <?php include '../public/upinfo.php'?>
    </div>
</form>
<script>
    var param_id = getQueryVariable('id') || 0;

    $("#operatePage").validate({
        rules: {
            daomoney: {required: true},
        },
        messages:{
            daomoney: {required: "请输入"},
        }
    });

    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();

        facade.ajax({type: 'get', url: ask_hou_jie_shou, data:{id:param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                $("#daomoney").val(data.daomoney);
                $("#daodt").val(data.daodt);
                $("#daoshuo").val(data.daoshuo);


                public_upload_file_load('upload_files', res.data.files);
                initParseMoney();
                render_date();
                render_from();
            }
        });



        form.on('submit(add)', function(data){
            var validRes = $("#operatePage").valid();

            if(!validRes){return false;}


            data.field.id = param_id;
            data.field.files = public_upload_file_value('upload_files');
            data = parseMoney(data);
            facade.ajax({url: ask_hou_jie_shou, data:data.field}).done(function(res){
                if (res.code === 2000) {
                    dataPostTimeOut();
                }
            });

            return false;
        });

    });




</script>
</body>
</html>
